package com.stars.empoly.activity

import android.view.View
import com.stars.empoly.adapter.CashListAdapter
import com.stars.empoly.base.MBRActivity
import com.stars.empoly.databinding.ActivityCashListBinding
import com.stars.empoly.model.DriverProfit
import com.stars.empoly.vmodel.CashListVModel
import com.trailer.base.net.IResp

/**
 *on 2021/7/19
 */
class CashListActicity: MBRActivity<CashListVModel, CashListAdapter, ActivityCashListBinding>() {

    override fun vmClass(): Class<CashListVModel> {
        return CashListVModel::class.java
    }
    override fun binding(): ActivityCashListBinding {
       return ActivityCashListBinding.inflate(layoutInflater)
    }

    override fun initAdapter(): CashListAdapter {
       return CashListAdapter(vm)
    }

    override fun onListReceive(res: IResp<*>) {
        super.onListReceive(res)

        if (null != res) {

            var list = res.data() as List<DriverProfit>
            if (list.isEmpty() && vm.repository().page == 1) {

                binding.listEmpty.visibility = View.VISIBLE
            } else {
                binding.listEmpty.visibility = View.GONE
            }

        }
    }


    override fun title(): String? {
        return "提现记录"
    }
}
